package com.example.workone;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class UC1 extends AppCompatActivity {
    private LinearLayout layout;
    private Button btnVrl;
    private Button btnHrl;
    private Button btnLft;
    private Button btnReturn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_uc1);  //显示id为activi_uc1的窗口
        layout = findViewById(R.id.L1);
        btnHrl = findViewById(R.id.bn1);
        btnVrl = findViewById(R.id.bn2);
        btnLft = findViewById(R.id.bn3);
        btnReturn =findViewById(R.id.bn4);

        btnVrl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                 layout.setOrientation(LinearLayout.VERTICAL);
                 layout.setGravity(0x10|0x01);
            }
        });

        btnHrl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                layout.setOrientation(LinearLayout.HORIZONTAL);
                layout.setGravity(0x10|0x01);

            }
        });

        btnLft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                layout.setGravity(0x03|0x11);
            }
        });

        btnReturn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //跳转到首页
                Intent intent = new Intent(UC1.this, MainActivity.class);
                startActivity(intent);
            }
        });


    }
}
